The Quantum IO Monad
نویسندگان
چکیده
We present an interface from Haskell to quantum programming: the Quantum IO monad, and use it to implement Shor’s factorisation algorithm. The QIO monad separates reversible (i.e. unitary) and irreversible (i.e. probabilistic) computations and provides a reversible let operation (ulet), allowing us to use ancillas (auxiliary qubits) in a modular fashion. Exploiting Haskell’s class system we can present our algorithms in a high level way, implementing abstractions in the functional paradigm. We describe the implementation of Shor’s algorithm in some detail also covering the necessary reversible arithmetic. QIO programs can be simulated either by calculating a probability distribution or by embedding it into the IO monad using the random number generator.
منابع مشابه
On the Automation of Encoding Processes in the Quantum IO Monad
It is now clear that the use of resilient encoding schemes will be required for any quantum computing device to be realised. However, quantum programmers of the future will not wish to be tied up in the particulars of such encoding schemes. Quantum programming languages and libraries are already being developed, one of which is the Quantum IO Monad. QIO, as it is often abbreviated to, provides ...
متن کاملA Monad of Imperative Streams
A new approach is presented for performing concurrent I/O in a functional programming language. A new monad St is introduced which generalizes Haskell's IO monad: A value of type St a represents an imperative program which, at certain times during its execution, will produce a value of type a. In contrast, a value of type IO a represents an imperative program which, at the end of its execution,...
متن کاملA Monadic Account of First-class Synchronous Events
These two quotations represent the key ideas behind two major research agendas. The first captures the essence of monadic I/O, which is the fundamental abstraction used to provide input/output and concurrency in the lazy, purely-functional language (Concurrent) Haskell. The second captures the essence of first-class synchronous events, which is the fundamental abstraction used to provide concur...
متن کاملSemantics of fixIO
Recent work on recursion over the values of monadic actions resulted in the introduction of a family of fixed point operators, one for each different kind of monadic effect. In the context of Haskell, the function fixIO is the corresponding operator for the IO monad. Unfortunately, both the IO monad and fixIO are language primitives in Haskell, i.e. they can not be defined within the language i...
متن کاملFormulating Haskell
The functional programming language Haskell is examined from the point of view of proving programs correct. Particular features explored include the data type deenition facilities, classes, the behaviour of patterns and guards and the monad approach to IO in the Glasgow Haskell compiler.
متن کامل